package com.jgame.secondarymarket.domain.product.repository;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jgame.secondarymarket.domain.product.entity.Product;
import com.jgame.secondarymarket.interfaces.query.page.product.PageProductQuery;

import java.util.Optional;

public interface ProductRepository extends IService<Product> {
    Optional<Product> findById(Long productId);

    void delById(Long productId);

    IPage<Product> getPageProduct(PageProductQuery query);

    /**
     * 若不存在则抛出异常
     *
     * @param productId
     * @return
     */
    Product getProductOrThrow(Long productId);
}
